package com.twotiger.and.adapter;

import java.util.ArrayList;
import java.util.List;

import app.twotiger.p2p.R;

import com.twotiger.and.Constants;
import com.twotiger.and.activity.base.AbastractListItem;
import com.twotiger.and.activity.base.BaseActivity;
import com.twotiger.and.bean.Basebean;
import com.twotiger.and.bean.DebtProjectdetailData;
import com.twotiger.and.bean.ProjectDetail;
import com.twotiger.and.bean.ProjectdetailData;

public class ProjectProtectinfoAdpter extends ProjectDetaillistAdpter {

    public ProjectProtectinfoAdpter(BaseActivity mActivity, Basebean projectdetail) {
        this.mActivity = mActivity;
        if (projectdetail instanceof ProjectdetailData) {
            this.datas = initList((ProjectdetailData) projectdetail);
        } else if (projectdetail instanceof DebtProjectdetailData) {
            this.datas = initList2((DebtProjectdetailData) projectdetail);
        }
    }

    //          2、项目--安全保障详情
    //          http://test.twotiger.net:1130/app2/safeguardPro?projectId=6
    //          3、更多--安全保障
    //          http://test.twotiger.net:1130/app2/safeguard

    private List<AbastractListItem> initList(ProjectDetail projectdetail) {
        ArrayList<AbastractListItem> tmp = new ArrayList<AbastractListItem>();
        AbastractListItem item1 = new ProjectDetailItem("本息保障", R.drawable.project_detail_v1_1,
            "由大型融资担保公司担保 本息保障", new itemClick(Constants.project_detail_introduction_safe
                                              + projectdetail.getProjectId() + "#one", "安全保障"));
        AbastractListItem item2 = new ProjectDetailItem("真正资金托管,保证资金安全",
            R.drawable.project_detail_v1_2, "融资全程由汇付天下 保证安全", new itemClick(
                Constants.project_detail_introduction_safe + projectdetail.getProjectId() + "#two",
                "安全保障"));
        AbastractListItem item3 = new ProjectDetailItem("联合审核，六层保障",
            R.drawable.project_detail_v1_3, "由老虎平台和担保机构联合实地考察", new itemClick(
                Constants.project_detail_introduction_safe + projectdetail.getProjectId()
                        + "#three", "安全保障"));
        AbastractListItem item4 = new ProjectDetailItem("历史本息100%兑付优质平台",
            R.drawable.project_detail_v1_4, "平台诚信透明，历史本息全额按时兑付",
            new itemClick(Constants.project_detail_introduction_safe + projectdetail.getProjectId()
                          + "#four", "安全保障"));
        tmp.add(item1);
        tmp.add(item2);
        tmp.add(item3);
        tmp.add(item4);
        return tmp;
    }

    private List<AbastractListItem> initList2(DebtProjectdetailData projectdetail) {
        ArrayList<AbastractListItem> tmp = new ArrayList<AbastractListItem>();
        AbastractListItem item1 = new ProjectDetailItem("本息保障", R.drawable.project_detail_v1_1,
            "由大型融资担保公司担保 本息保障", new itemClick(Constants.project_detail_introduction_safe
                                              + projectdetail.getProjectId(), "安全保障"));
        AbastractListItem item2 = new ProjectDetailItem("真正资金托管,保证资金安全",
            R.drawable.project_detail_v1_2, "融资全程由汇付天下 保证安全", new itemClick(
                Constants.project_detail_introduction_safe + projectdetail.getProjectId(), "安全保障"));
        AbastractListItem item3 = new ProjectDetailItem("联合审核，六层保障",
            R.drawable.project_detail_v1_3, "由老虎平台和担保机构联合实地考察", new itemClick(
                Constants.project_detail_introduction_safe + projectdetail.getProjectId(), "安全保障"));
        AbastractListItem item4 = new ProjectDetailItem("历史本息100%兑付优质平台",
            R.drawable.project_detail_v1_4, "平台诚信透明，历史本息全额按时兑付", new itemClick(
                Constants.project_detail_introduction_safe + projectdetail.getProjectId(), "安全保障"));
        tmp.add(item1);
        tmp.add(item2);
        tmp.add(item3);
        tmp.add(item4);
        return tmp;
    }
}
